#ifndef DAO_H
#define DAO_H

#include <header.h>
#include "mysql.h"
#include "User.h"
#include "File.h"
/* 登录注册 */
void findUserByIdDAO();

void updateUserDAO();


/* 通过用户id查找用户名 */
int findUserIdByNameDAO(MYSQL *conn, char *uname);

/* 通过用户名查找用户所有信息 */
User* findUserByNameDAO(MYSQL *conn, char *uname);

int insertUserDAO(MYSQL *conn, char *uname, char *cryptpwd);


void insertDirectoryByUserIdDAO(MYSQL *conn, User *user);




void findDirectoryByIdDAO();


void findDiretoryAndFileByIdDAO();



void updateFileByIdDAO();


void findFileByIdDAO();


void removeDirectoryByIdDAO();

void removeFileByIdDAO(MYSQL *conn, File *file);

int findFileIsShareDAO(MYSQL *conn, File *file);
File* findFileByUidAndFileNameDAO(MYSQL *conn, User *user, char *filename);


/* 调用存储过程，用户上传文件和文件共享 */
void insertIntoFileAndShareDAO(MYSQL *conn, int uid, const char *fileName, long filesize, const char *md5, const char *currentDir);

File *isUserHaveThisFileDAO(MYSQL *conn, const char *fileName, const char *currentDir);
#endif // !DAO_H